<?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;

class BistroIncomeMonth extends Model
{
    //
    protected $table = 'bistro_income_months';

    protected $fillable = [
        'bistro_id', 'month', 'year', 'income', 'outcome'
    ];

    public function scopeMonth($query, $month) {
        if(!empty($month)) {
            return $query->where('month', $month);
        }
        return $query;
    }

    public function scopeBistroId($query, $bistro_id) {
        if(!empty($bistro_id)) {
            return $query->where('bistro_id', $bistro_id);
        }
        return $query;
    }
}
